﻿using System;
using System.Collections.Generic;


public class TestProgram
{

    public void Testprint1()
    {
        Console.WriteLine("=== 三个整数排序 ===");
        Console.WriteLine("请输入三个整数（空格分隔）：");
        string[] input = Console.ReadLine().Split();
        int x = int.Parse(input[0]);
        int y = int.Parse(input[1]);
        int z = int.Parse(input[2]);

        int[] nums = { x, y, z };
        Array.Sort(nums);
        Console.WriteLine("排序结果：" + string.Join(" ", nums) + "\n");
    }

    
    public void Testprint2()
    {
        Console.WriteLine("=== 1-100特殊数字筛选 ===");
        int sum = 0;
        List<int> validNumbers = new List<int>();

        for (int i = 1; i <= 100; i++)
        {
            if (i % 7 != 0 && !i.ToString().Contains("7"))
            {
                validNumbers.Add(i);
                sum += i;
            }
        }

        Console.WriteLine("符合条件的数字：" + string.Join(" ", validNumbers));
        Console.WriteLine("数字总和：" + sum + "\n");
    }

   
    public void Testprint3()
    {
        Console.WriteLine("=== 九九乘法表 ===");
        for (int i = 1; i <= 9; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                Console.Write($"{j}×{i}={j * i}\t");
            }
            Console.WriteLine();
        }
        Console.WriteLine();
    }

   
    public void Testprint4()
    {
        Console.WriteLine("=== 1000以内的完数 ===");
        List<int> perfectNumbers = new List<int>();

        for (int num = 2; num <= 1000; num++)
        {
            int sum = 0;
            for (int i = 1; i < num; i++)
            {
                
                if (num % i == 0) sum += i;
            }
            if (sum == num) perfectNumbers.Add(num);
        }

        Console.WriteLine("完数列表：" + string.Join(" ", perfectNumbers) + "\n");
    }

    
 public void Testprint5()
    {
        Console.WriteLine("=== 数字位数与逆序 ===");
        Console.WriteLine("请输入一个正整数：");
        int n = int.Parse(Console.ReadLine());
        int temp = n;
        int digitCount = 0;
        string reversed = "";

        while (temp != 0)
        {
            reversed += temp % 10 + " ";
            temp /= 10;
            digitCount++;
        }

        Console.WriteLine($"位数：{digitCount}");
        Console.WriteLine("逆序数字：" + reversed.Trim() + "\n");
    }

   
    public void Testprint6()
    {
        Console.WriteLine("=== 打印菱形 ===");
        Console.WriteLine("请输入菱形行数（奇数）：");
        int rows = int.Parse(Console.ReadLine());
        int half = (rows + 1) / 2;

       
        for (int i = 1; i <= half; i++)
        {
            Console.Write(new string(' ', half - i));
            Console.WriteLine(new string('*', 2 * i - 1));
        }

       
        for (int i = half - 1; i >= 1; i--)
        {
            Console.Write(new string(' ', half - i));
            Console.WriteLine(new string('*', 2 * i - 1));
        }
        Console.WriteLine();
    }
    
    public static void Main()
    {
        TestProgram program = new TestProgram();
        // 依次调用所有测试方法
        program.Testprint1();
        program.Testprint2();
        program.Testprint3();
        program.Testprint4();
        program.Testprint5();
        program.Testprint6();
    }
}